home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / Libraries / WASTE 1.3a5 / WASTE C⁄C++ Headers / WASTE.h < prev   
Encoding:
C/C++ Source or Header  |  1997-07-25  |  40.1 KB  |  867 lines  |  [TEXT/CWIE]

  1. /*
  2.  *    WASTE.h
  3.  *
  4.  *    C/C++ interface to the WASTE text engine
  5.  *
  6.  *    version 1.3a5 (July 1997)
  7.  *
  8.  *    Copyright (c) 1993-1997 Marco Piovanelli
  9.  *    All Rights Reserved
  10.  *
  11.  */
  12.  
  13. #ifndef _WASTE_
  14. #define _WASTE_
  15.  
  16. #ifndef __CONDITIONALMACROS__
  17. #include <ConditionalMacros.h>
  18. #endif
  19.  
  20. #ifndef UNIVERSAL_INTERFACES_VERSION
  21. #error "You need Universal Headers version 2.1 or newer to use WASTE.h"
  22. #endif
  23.  
  24. #ifndef __TYPES__
  25. #include <Types.h>
  26. #endif
  27.  
  28. #ifndef __MIXEDMODE__
  29. #include <MixedMode.h>
  30. #endif
  31.  
  32. #ifndef __QUICKDRAWTEXT__
  33. #include <QuickdrawText.h>
  34. #endif
  35.  
  36. #ifndef __QUICKDRAW__
  37. #include <Quickdraw.h>
  38. #endif
  39.  
  40. #ifndef __SCRIPT__
  41. #include <Script.h>
  42. #endif
  43.  
  44. #ifndef __TEXTUTILS__
  45. #include <TextUtils.h>
  46. #endif
  47.  
  48. #ifndef __TEXTEDIT__
  49. #include <TextEdit.h>
  50. #endif
  51.  
  52. #ifndef __DRAG__
  53. #include <Drag.h>
  54. #endif
  55.  
  56. #ifndef __LONGCOORDINATES__
  57. #ifndef _LongCoords_
  58. #include "LongCoords.h"
  59. #endif
  60. #endif
  61.  
  62. #ifdef __cplusplus
  63. extern "C" {
  64. #endif
  65.  
  66. #if PRAGMA_ALIGN_SUPPORTED
  67. #pragma options align=mac68k
  68. #endif
  69.  
  70. #if PRAGMA_IMPORT_SUPPORTED
  71. #pragma import on
  72. #endif
  73.  
  74. //    The macro WASTE_VERSION expands to the current version of WASTE,
  75. //    expressed in standard NumVersion format (see Types.h)
  76. //    The macro WASTE11 is obsolete but still supported for backward
  77. //    compatibility
  78.  
  79. #define WASTE_VERSION    0x01304005        /* 1.3a5 */
  80. #define WASTE11
  81.  
  82. /*    result codes */
  83.  
  84. enum
  85. {
  86.     weCantUndoErr            =    -10015,    /* undo buffer is clear (= errAECantUndo) */
  87.     weEmptySelectionErr        =    -10013,    /* selection range is empty (= errAENoUserSelection) */
  88.     weNotHandledErr            =    -1708,    /* please use default behavior (= errAEEventNotHandled) */
  89.     weUnknownObjectTypeErr    =    -9478,    /* specified object type is not registered */
  90.     weObjectNotFoundErr        =    -9477,    /* no object found at specified offset */
  91.     weReadOnlyErr            =    -9476,    /* instance is read-only */
  92.     weUndefinedSelectorErr    =    -50        /* unknown selector (= paramErr) */
  93. };
  94.  
  95. /*    alignment styles */
  96.  
  97. enum
  98. {
  99.     weFlushLeft         =    -2,        /* flush left */
  100.     weFlushRight        =    -1,        /* flush right */
  101.     weFlushDefault        =     0,        /* flush according to system direction */
  102.     weCenter            =     1,        /* centered */
  103.     weJustify            =     2        /* fully justified */
  104. };
  105.  
  106. /*    primary line direction */
  107.  
  108. enum
  109. {
  110.     weDirDefault        =     1,        /* according to system direction */
  111.     weDirRightToLeft    =    -1,        /* force right-to-left */
  112.     weDirLeftToRight    =     0        /* force left-to-right */
  113. };
  114.  
  115. /*    values for the mode parameter in WESetStyle and WEContinuousStyle */
  116.  
  117. enum
  118. {
  119.     weDoFont                =    0x0001,
  120.     weDoFace                =    0x0002,
  121.     weDoSize                =    0x0004,
  122.     weDoColor                =    0x0008,
  123.     weDoAll                    =    weDoFont + weDoFace + weDoSize + weDoColor,
  124.     weDoAddSize                =    0x0010,
  125.     weDoToggleFace            =    0x0020,
  126.     weDoReplaceFace            =    0x0040,
  127.     weDoPreserveScript        =    0x0080,
  128.     weDoExtractSubscript    =    0x0100,
  129.     weDoFaceMask            =    0x0200
  130. };
  131.  
  132. /*    values for the edge parameter in WEGetOffset etc. */
  133.  
  134. enum
  135. {
  136.     kLeadingEdge = -1,        /* point is on the leading edge of a glyph */
  137.     kTrailingEdge = 0,        /* point is on the trailing edge of a glyph */
  138.     kObjectEdge = 2            /* point is in the middle of an embedded object */
  139. };
  140.  
  141. /*    values for WEFeatureFlag feature parameter */
  142.  
  143. enum
  144. {
  145.     weFAutoScroll        =    0,        /* automatically scroll the selection range into view */
  146.     weFOutlineHilite    =    2,        /* frame selection when deactivated */
  147.     weFReadOnly            =    5,        /* disallow modifications */
  148.     weFUndo                =    6,        /* support WEUndo() */
  149.     weFIntCutAndPaste    =    7,        /* use intelligent cut-and-paste rules */
  150.     weFDragAndDrop        =    8,        /* support drag-and-drop text editing */
  151.     weFInhibitRecal        =    9,        /* don't recalculate line starts and don't redraw text */
  152.     weFUseTempMem        =    10,        /* use temporary memory for main data structures */
  153.     weFDrawOffscreen    =    11,        /* draw text offscreen for smoother visual results */
  154.     weFInhibitRedraw    =    12,        /* don't redraw text */
  155.     weFMonoStyled        =    13,        /* disallow style changes */
  156.     weFInhibitColor        =    31        /* draw in black & white only */
  157. };
  158.  
  159. /*    values for WENew flags parameter */
  160.  
  161. enum
  162. {
  163.     weDoAutoScroll        =    1L << weFAutoScroll,
  164.     weDoOutlineHilite    =    1L << weFOutlineHilite,
  165.     weDoReadOnly        =    1L << weFReadOnly,
  166.     weDoUndo            =    1L << weFUndo,
  167.     weDoIntCutAndPaste    =    1L << weFIntCutAndPaste,
  168.     weDoDragAndDrop        =    1L << weFDragAndDrop,
  169.     weDoInhibitRecal    =    1L << weFInhibitRecal,
  170.     weDoUseTempMem        =    1L << weFUseTempMem,
  171.     weDoDrawOffscreen    =    1L << weFDrawOffscreen,
  172.     weDoInhibitRedraw    =    1L << weFInhibitRedraw,
  173.     weDoMonoStyled        =    1L << weFMonoStyled,
  174.     weDoInhibitColor    =    1L << weFInhibitColor
  175. };
  176.  
  177. /*    values for WEFeatureFlag action parameter */
  178.  
  179. enum
  180. {
  181.     weBitToggle = -2,    /* toggles the specified feature */
  182.     weBitTest,            /* returns the current setting of the specified feature */
  183.     weBitClear,            /* disables the specified feature */
  184.     weBitSet            /* enables the specified feature */
  185. };
  186.  
  187. /*    selectors for WEGetInfo and WESetInfo */
  188.  
  189. enum
  190. {
  191.     weCharByteHook                =    'cbyt', /* CharByte hook */
  192.     weCharToPixelHook            =    'c2p ',    /* CharToPixel hook */
  193.     weCharTypeHook                =    'ctyp', /* CharType hook */
  194.     weClickLoop                    =    'clik',    /* click loop callback */
  195.     weCurrentDrag                =    'drag',    /* drag currently being tracked from WEClick() */
  196.     weDrawTextHook                =    'draw', /* text drawing hook */
  197.     weEraseHook                    =    'eras', /* background erasing hook */
  198.     weFluxProc                    =    'flux', /* flux proc */
  199.     weHiliteDropAreaHook        =    'hidr', /* drop area highlighting hook */
  200.     weLineBreakHook                =    'lbrk',    /* line breaking hook */
  201.     wePixelToCharHook            =    'p2c ', /* PixelToChar hook */
  202.     wePort                        =    'port',    /* graphics port */
  203.     weRefCon                    =    'refc',    /* reference constant for use by application */
  204.     weScrollProc                =    'scrl',    /* auto-scroll callback */
  205.     weText                        =    'text',    /* text handle */
  206.     weTranslateDragHook         =    'xdrg', /* drag translation callback */
  207.     weTranslucencyThreshold        =    'tluc', /* area threshold for translucent drags */
  208.     weTSMDocumentID                =    'tsmd',    /* Text Services Manager document ID */
  209.     weTSMPreUpdate                =    'pre ',    /* Text Services Manager pre-update callback */
  210.     weTSMPostUpdate                =    'post',    /* Text Services Manager post-update callback */
  211.     weURLHint                    =    'urlh',    /* URL hint string for Internet Config */
  212.     weWordBreakHook                =    'wbrk'    /* word breaking hook */
  213. };
  214.  
  215. /*    values for WEInstallObjectHandler handlerSelector parameter */
  216.  
  217. enum
  218. {
  219.     weNewHandler        =    'new ',        /* new handler */
  220.     weDisposeHandler    =    'free',        /* dispose handler */
  221.     weDrawHandler        =    'draw',        /* draw handler */
  222.     weClickHandler        =    'clik',        /* click handler */
  223.     weStreamHandler        =    'strm'        /* stream handler */
  224. };
  225.  
  226. /*    action kinds */
  227.  
  228. enum
  229. {
  230.     weAKNone            =    0,        /* null action */
  231.     weAKUnspecified        =    1,        /* action of unspecified nature */
  232.     weAKTyping            =    2,        /* some text has been typed in */
  233.     weAKCut                =    3,        /* the selection range has been cut */
  234.     weAKPaste            =    4,        /* something has been pasted */
  235.     weAKClear            =    5,        /* the selection range has been deleted */
  236.     weAKDrag            =    6,        /* drag and drop operation */
  237.     weAKSetStyle        =    7        /* some style has been applied to a text range */
  238. };
  239.  
  240. /*    destination kinds for stream handler */
  241.  
  242. enum
  243. {
  244.     weToScrap            =    0,
  245.     weToDrag            =    1,
  246.     weToSoup            =    2
  247. };
  248.  
  249. typedef struct OpaqueWEReference *WEReference;
  250. typedef struct OpaqueWEObjectReference *WEObjectReference;
  251. typedef Handle WESoupHandle;
  252. typedef Handle WEFontTableHandle;
  253. typedef SInt16 WEActionKind;
  254. typedef SInt8 WEAlignment;
  255. typedef SInt16 WEDirection;
  256. typedef SInt8 WEEdge;
  257. typedef UInt16 WEStyleMode;
  258. typedef FourCharCode WESelector;
  259. typedef WEReference WEHandle;    /* obsolete, kept for backward compatibility */
  260.  
  261. typedef struct WERunInfo
  262. {
  263.     SInt32                 runStart;    /* byte offset to first character of style run */
  264.     SInt32                 runEnd;        /* byte offset past last character of style run */
  265.     SInt16                 runHeight;    /* line height (ascent + descent + leading) */
  266.     SInt16                 runAscent;    /* font ascent */
  267.     TextStyle             runStyle;    /* text attributes */
  268.     WEObjectReference    runObject;    /* either nil or reference to embedded object */
  269. } WERunInfo;
  270.  
  271.  
  272. /*    callback prototypes */
  273.  
  274. typedef pascal Boolean (*WEClickLoopProcPtr)(WEReference we);
  275. typedef pascal void (*WEScrollProcPtr)(WEReference we);
  276. typedef pascal void (*WETSMPreUpdateProcPtr)(WEReference we);
  277. typedef pascal void (*WETSMPostUpdateProcPtr)(WEReference we,
  278.         SInt32 fixLength, SInt32 inputAreaStart, SInt32 inputAreaEnd,
  279.         SInt32 pinRangeStart, SInt32 pinRangeEnd);
  280. typedef pascal OSErr (*WETranslateDragProcPtr)(DragReference theDrag,
  281.         ItemReference theItem, FlavorType requestedType, Handle putDataHere,
  282.         SInt32 dropOffset, WEReference we);
  283. typedef pascal OSErr (*WEHiliteDropAreaProcPtr)(DragReference theDrag,
  284.         Boolean hiliteFlag, WEReference we);
  285. typedef pascal OSErr (*WEFontIDToNameProcPtr)(SInt16 fontID, Str255 fontName);
  286. typedef pascal OSErr (*WEFontNameToIDProcPtr)(ConstStr255Param fontName, SInt16 oldFontID, SInt16 *newFontID);
  287. typedef pascal void (*WEDrawTextProcPtr)(Ptr pText, SInt32 textLength, Fixed slop,
  288.         JustStyleCode styleRunPosition, WEReference we);
  289. typedef pascal SInt32 (*WEPixelToCharProcPtr)(Ptr pText, SInt32 textLength, Fixed slop,
  290.         Fixed *pixelWidth, WEEdge *edge, JustStyleCode styleRunPosition, Fixed hPos, WEReference we);
  291. typedef pascal SInt16 (*WECharToPixelProcPtr)(Ptr pText, SInt32 textLength, Fixed slop,
  292.         SInt32 offset, SInt16 direction, JustStyleCode styleRunPosition, SInt16 hPos, WEReference we);
  293. typedef pascal StyledLineBreakCode (*WELineBreakProcPtr)(Ptr pText, SInt32 textLength,
  294.         SInt32 textStart, SInt32 textEnd, Fixed *textWidth, SInt32 *textOffset, WEReference we);
  295. typedef pascal void (*WEWordBreakProcPtr)(Ptr pText, SInt16 textLength, SInt16 offset,
  296.         WEEdge edge, OffsetTable breakOffsets, ScriptCode script, WEReference we);
  297. typedef pascal SInt16 (*WECharByteProcPtr)(Ptr pText, SInt16 textOffset, ScriptCode script,
  298.         WEReference we);
  299. typedef pascal SInt16 (*WECharTypeProcPtr)(Ptr pText, SInt16 textOffset, ScriptCode script, WEReference we);
  300. typedef pascal void (*WEEraseProcPtr)(const Rect *area, WEReference we);
  301. typedef pascal void (*WEFluxProcPtr)(SInt32 offset, SInt32 delta, WEReference we);
  302. typedef pascal OSErr (*WENewObjectProcPtr)(Point *defaultObjectSize,
  303.         WEObjectReference obj);
  304. typedef pascal OSErr (*WEDisposeObjectProcPtr)(WEObjectReference obj);
  305. typedef pascal OSErr (*WEDrawObjectProcPtr)(const Rect *destRect,
  306.         WEObjectReference obj);
  307. typedef pascal Boolean (*WEClickObjectProcPtr)(Point hitPt, EventModifiers modifiers, UInt32 clickTime,
  308.         WEObjectReference obj);
  309. typedef pascal OSErr (*WEStreamObjectProcPtr)(SInt16 destKind, FlavorType *theType,
  310.         Handle putDataHere, WEObjectReference obj);
  311.  
  312.  
  313. /*    UPP proc info */
  314.  
  315. enum
  316. {
  317.     uppWEClickLoopProcInfo = kPascalStackBased
  318.         | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
  319.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(WEReference /*we*/))),
  320.     uppWEScrollProcInfo = kPascalStackBased
  321.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(WEReference /*we*/))),
  322.     uppWETSMPreUpdateProcInfo = kPascalStackBased
  323.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(WEReference /*we*/))),
  324.     uppWETSMPostUpdateProcInfo = kPascalStackBased
  325.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(WEReference /*we*/)))
  326.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt32 /*fixLength*/)))
  327.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(SInt32 /*inputAreaStart*/)))
  328.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(SInt32 /*inputAreaEnd*/)))
  329.         | STACK_ROUTINE_PARAMETER(5,SIZE_CODE(sizeof(SInt32 /*pinRangeStart*/)))
  330.         | STACK_ROUTINE_PARAMETER(6,SIZE_CODE(sizeof(SInt32 /*pinRangeEnd*/))),
  331.     uppWETranslateDragProcInfo = kPascalStackBased
  332.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  333.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(DragReference /*theDrag*/)))
  334.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(ItemReference /*theItem*/)))
  335.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(FlavorType /*requestedType*/)))
  336.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(Handle /*putDataHere*/)))
  337.         | STACK_ROUTINE_PARAMETER(5,SIZE_CODE(sizeof(SInt32 /*dropOffset*/)))
  338.         | STACK_ROUTINE_PARAMETER(6,SIZE_CODE(sizeof(WEReference /*we*/))),
  339.     uppWEHiliteDropAreaProcInfo = kPascalStackBased
  340.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  341.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(DragReference /*theDrag*/)))
  342.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(Boolean /*hiliteFlag*/)))
  343.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(WEReference /*we*/))),
  344.     uppWEFontIDToNameProcInfo = kPascalStackBased
  345.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  346.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(SInt16 /*fontID*/)))
  347.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(StringPtr /*fontName*/))),
  348.     uppWEFontNameToIDProcInfo = kPascalStackBased
  349.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  350.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(ConstStr255Param /*fontName*/)))
  351.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt16 /*oldFontID*/)))
  352.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(SInt16 * /*newFontID*/))),
  353.     uppWEDrawTextProcInfo = kPascalStackBased
  354.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Ptr /*pText*/)))
  355.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt32 /*textLength*/)))
  356.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(Fixed /*slop*/)))
  357.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(JustStyleCode /*styleRunPosition*/)))
  358.         | STACK_ROUTINE_PARAMETER(5,SIZE_CODE(sizeof(WEReference /*we*/))),
  359.     uppWEPixelToCharProcInfo = kPascalStackBased
  360.         | RESULT_SIZE(SIZE_CODE(sizeof(SInt32)))
  361.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Ptr /*pText*/)))
  362.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt32 /*textLength*/)))
  363.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(Fixed /*slop*/)))
  364.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(Fixed * /*pixelWidth*/)))
  365.         | STACK_ROUTINE_PARAMETER(5,SIZE_CODE(sizeof(WEEdge * /*edge*/)))
  366.         | STACK_ROUTINE_PARAMETER(6,SIZE_CODE(sizeof(JustStyleCode /*styleRunPosition*/)))
  367.         | STACK_ROUTINE_PARAMETER(7,SIZE_CODE(sizeof(Fixed /*hPos*/)))
  368.         | STACK_ROUTINE_PARAMETER(8,SIZE_CODE(sizeof(WEReference /*we*/))),
  369.     uppWECharToPixelProcInfo = kPascalStackBased
  370.         | RESULT_SIZE(SIZE_CODE(sizeof(SInt16)))
  371.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Ptr /*pText*/)))
  372.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt32 /*textLength*/)))
  373.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(Fixed /*slop*/)))
  374.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(SInt32 /*offset*/)))
  375.         | STACK_ROUTINE_PARAMETER(5,SIZE_CODE(sizeof(SInt16 /*direction*/)))
  376.         | STACK_ROUTINE_PARAMETER(6,SIZE_CODE(sizeof(JustStyleCode /*styleRunPosition*/)))
  377.         | STACK_ROUTINE_PARAMETER(7,SIZE_CODE(sizeof(SInt16 /*hPos*/)))
  378.         | STACK_ROUTINE_PARAMETER(8,SIZE_CODE(sizeof(WEReference /*we*/))),
  379.     uppWELineBreakProcInfo = kPascalStackBased
  380.         | RESULT_SIZE(SIZE_CODE(sizeof(StyledLineBreakCode )))
  381.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Ptr /*pText*/)))
  382.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt32 /*textLength*/)))
  383.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(SInt32 /*textStart*/)))
  384.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(SInt32 /*textEnd*/)))
  385.         | STACK_ROUTINE_PARAMETER(5,SIZE_CODE(sizeof(Fixed * /*textWidth*/)))
  386.         | STACK_ROUTINE_PARAMETER(6,SIZE_CODE(sizeof(SInt32 * /*textOffset*/)))
  387.         | STACK_ROUTINE_PARAMETER(7,SIZE_CODE(sizeof(WEReference /*we*/))),
  388.     uppWEWordBreakProcInfo = kPascalStackBased
  389.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Ptr /*pText*/)))
  390.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt16 /*textLength*/)))
  391.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(SInt16 /*offset*/)))
  392.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(WEEdge /*edge*/)))
  393.         | STACK_ROUTINE_PARAMETER(5,SIZE_CODE(sizeof(OffsetTable * /*breakOffsets*/)))
  394.         | STACK_ROUTINE_PARAMETER(6,SIZE_CODE(sizeof(ScriptCode /*script*/)))
  395.         | STACK_ROUTINE_PARAMETER(7,SIZE_CODE(sizeof(WEReference /*we*/))),
  396.     uppWECharByteProcInfo = kPascalStackBased
  397.         | RESULT_SIZE(SIZE_CODE(sizeof(SInt16 )))
  398.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Ptr /*pText*/)))
  399.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt16 /*textOffset*/)))
  400.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(ScriptCode /*script*/)))
  401.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(WEReference /*we*/))),
  402.     uppWECharTypeProcInfo = kPascalStackBased
  403.         | RESULT_SIZE(SIZE_CODE(sizeof(SInt16 )))
  404.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Ptr /*pText*/)))
  405.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt16 /*textOffset*/)))
  406.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(ScriptCode /*script*/)))
  407.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(WEReference /*we*/))),
  408.     uppWEEraseProcInfo = kPascalStackBased
  409.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(const Rect * /*area*/)))
  410.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(WEReference /*we*/))),
  411.     uppWEFluxProcInfo = kPascalStackBased
  412.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(SInt32 /*offset*/)))
  413.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt32 /*delta*/)))
  414.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(WEReference /*we*/))),
  415.     uppWENewObjectProcInfo = kPascalStackBased
  416.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  417.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Point * /*defaultObjectSize*/)))
  418.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(WEObjectReference /*obj*/))),
  419.     uppWEDisposeObjectProcInfo = kPascalStackBased
  420.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  421.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(WEObjectReference /*obj*/))),
  422.     uppWEDrawObjectProcInfo = kPascalStackBased
  423.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  424.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(const Rect * /*destRect*/)))
  425.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(WEObjectReference /*obj*/))),
  426.     uppWEClickObjectProcInfo = kPascalStackBased
  427.         | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
  428.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Point /*hitPt*/)))
  429.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(EventModifiers /*modifiers*/)))
  430.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(UInt32 /*clickTime*/)))
  431.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(WEObjectReference /*obj*/))),
  432.     uppWEStreamObjectProcInfo = kPascalStackBased
  433.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  434.         | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(SInt16 /*destKind*/)))
  435.         | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(FlavorType * /*theType*/)))
  436.         | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(Handle /*putDataHere*/)))
  437.         | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(WEObjectReference /*obj*/)))
  438. };
  439.  
  440.  
  441. /*    UPPs, New≈Proc macros & Call≈Proc macros */
  442.  
  443. /*
  444.     NOTE:
  445.     For compatibility with the Pascal version, Call≈Proc macros take the form:
  446.  
  447.         CallFooProc(..., userRoutine)
  448.  
  449.     instead of:
  450.  
  451.         CallFooProc(userRoutine, ...)
  452.  
  453. */
  454.  
  455. #if GENERATINGCFM
  456.  
  457. typedef UniversalProcPtr WEClickLoopUPP;
  458. typedef UniversalProcPtr WEScrollUPP;
  459. typedef UniversalProcPtr WETSMPreUpdateUPP;
  460. typedef UniversalProcPtr WETSMPostUpdateUPP;
  461. typedef UniversalProcPtr WETranslateDragUPP;
  462. typedef UniversalProcPtr WEHiliteDropAreaUPP;
  463. typedef UniversalProcPtr WEFontIDToNameUPP;
  464. typedef UniversalProcPtr WEFontNameToIDUPP;
  465. typedef UniversalProcPtr WEDrawTextUPP;
  466. typedef UniversalProcPtr WEPixelToCharUPP;
  467. typedef UniversalProcPtr WECharToPixelUPP;
  468. typedef UniversalProcPtr WELineBreakUPP;
  469. typedef UniversalProcPtr WEWordBreakUPP;
  470. typedef UniversalProcPtr WECharByteUPP;
  471. typedef UniversalProcPtr WECharTypeUPP;
  472. typedef UniversalProcPtr WENewObjectUPP;
  473. typedef UniversalProcPtr WEEraseUPP;
  474. typedef UniversalProcPtr WEFluxUPP;
  475. typedef UniversalProcPtr WEDisposeObjectUPP;
  476. typedef UniversalProcPtr WEDrawObjectUPP;
  477. typedef UniversalProcPtr WEClickObjectUPP;
  478. typedef UniversalProcPtr WEStreamObjectUPP;
  479.  
  480. #define NewWEClickLoopProc(userRoutine) \
  481.     (WEClickLoopUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEClickLoopProcInfo, GetCurrentArchitecture())
  482. #define NewWEScrollProc(userRoutine) \
  483.     (WEScrollUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEScrollProcInfo, GetCurrentArchitecture())
  484. #define NewWETSMPreUpdateProc(userRoutine) \
  485.     (WETSMPreUpdateUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWETSMPreUpdateProcInfo, GetCurrentArchitecture())
  486. #define NewWETSMPostUpdateProc(userRoutine) \
  487.     (WETSMPostUpdateUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWETSMPostUpdateProcInfo, GetCurrentArchitecture())
  488. #define NewWETranslateDragProc(userRoutine) \
  489.     (WETranslateDragUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWETranslateDragProcInfo, GetCurrentArchitecture())
  490. #define NewWEHiliteDropAreaProc(userRoutine) \
  491.     (WEHiliteDropAreaUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEHiliteDropAreaProcInfo, GetCurrentArchitecture())
  492. #define NewWEFontIDToNameProc(userRoutine) \
  493.     (WEFontIDToNameUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEFontIDToNameProcInfo, GetCurrentArchitecture())
  494. #define NewWEFontNameToIDProc(userRoutine) \
  495.     (WEFontNameToIDUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEFontNameToIDProcInfo, GetCurrentArchitecture())
  496. #define NewWEDrawTextProc(userRoutine) \
  497.     (WEDrawTextUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEDrawTextProcInfo, GetCurrentArchitecture())
  498. #define NewWEPixelToCharProc(userRoutine) \
  499.     (WEPixelToCharUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEPixelToCharProcInfo, GetCurrentArchitecture())
  500. #define NewWECharToPixelProc(userRoutine) \
  501.     (WECharToPixelUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWECharToPixelProcInfo, GetCurrentArchitecture())
  502. #define NewWELineBreakProc(userRoutine) \
  503.     (WELineBreakUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWELineBreakProcInfo, GetCurrentArchitecture())
  504. #define NewWEWordBreakProc(userRoutine) \
  505.     (WEWordBreakUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEWordBreakProcInfo, GetCurrentArchitecture())
  506. #define NewWECharByteProc(userRoutine) \
  507.     (WECharByteUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWECharByteProcInfo, GetCurrentArchitecture())
  508. #define NewWECharTypeProc(userRoutine) \
  509.     (WECharTypeUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWECharTypeProcInfo, GetCurrentArchitecture())
  510. #define NewWEEraseProc(userRoutine) \
  511.     (WEEraseUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEEraseProcInfo, GetCurrentArchitecture())
  512. #define NewWEFluxProc(userRoutine) \
  513.     (WEFluxUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEFluxProcInfo, GetCurrentArchitecture())
  514. #define NewWENewObjectProc(userRoutine) \
  515.     (WENewObjectUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWENewObjectProcInfo, GetCurrentArchitecture())
  516. #define NewWEDisposeObjectProc(userRoutine) \
  517.     (WEDisposeObjectUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEDisposeObjectProcInfo, GetCurrentArchitecture())
  518. #define NewWEDrawObjectProc(userRoutine) \
  519.     (WEDrawObjectUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEDrawObjectProcInfo, GetCurrentArchitecture())
  520. #define NewWEClickObjectProc(userRoutine) \
  521.     (WEClickObjectUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEClickObjectProcInfo, GetCurrentArchitecture())
  522. #define NewWEStreamObjectProc(userRoutine) \
  523.     (WEStreamObjectUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEStreamObjectProcInfo, GetCurrentArchitecture())
  524.  
  525. #define CallWEClickLoopProc(we, userRoutine) \
  526.     CallUniversalProc((userRoutine), uppWEClickLoopProcInfo, (we))
  527. #define CallWEScrollProc(we, userRoutine) \
  528.     CallUniversalProc((userRoutine), uppWEScrollProcInfo, (we))
  529. #define CallWETSMPreUpdateProc(we, userRoutine) \
  530.     CallUniversalProc((userRoutine), uppWETSMPreUpdateProcInfo, (we))
  531. #define CallWETSMPostUpdateProc(we, fixLength, inputAreaStart, inputAreaEnd, pinRangeStart, pinRangeEnd, userRoutine) \
  532.     CallUniversalProc((userRoutine), uppWETSMPostUpdateProcInfo, (we), (fixLength), (inputAreaStart), (inputAreaEnd), (pinRangeStart), (pinRangeEnd))
  533. #define CallWETranslateDragProc(theDrag, theItem, requestedType, putDataHere, dropOffset, we, userRoutine) \
  534.     CallUniversalProc((userRoutine), uppWETranslateDragProcInfo, (theDrag), (theItem), (requestedType), (putDataHere), (dropOffset), (we))
  535. #define CallWEHiliteDropAreaProc(theDrag, hiliteFlag, we, userRoutine) \
  536.     CallUniversalProc((userRoutine), uppWEHiliteDropAreaProcInfo, (theDrag), (hiliteFlag), (we))
  537. #define CallWEFontIDToNameProc(fontID, fontName, userRoutine) \
  538.     CallUniversalProc((userRoutine), uppWEFontIDToNameProcInfo, (fontID), (fontName))
  539. #define CallWEFontNameToIDProc(fontName, oldFontID, newFontID, userRoutine) \
  540.     CallUniversalProc((userRoutine), uppWEFontNameToIDProcInfo, (fontName), (oldFontID), (newFontID))
  541. #define CallWEDrawTextProc(pText, textLength, slop, styleRunPosition, we, userRoutine) \
  542.     CallUniversalProc((userRoutine), uppWEDrawTextProcInfo, (pText), (textLength), (slop), (styleRunPosition), (we))
  543. #define CallWEPixelToCharProc(pText, textLength, slop, pixelWidth, edge, styleRunPosition, hPos, we, userRoutine) \
  544.     CallUniversalProc((userRoutine), uppWEPixelToCharProcInfo, (pText), (textLength), (slop), (pixelWidth), (edge), (styleRunPosition), (hPos), (we))
  545. #define CallWECharToPixelProc(pText, textLength, slop, offset, direction, styleRunPosition, hPos, we, userRoutine) \
  546.     CallUniversalProc((userRoutine), uppWECharToPixelProcInfo, (pText), (textLength), (slop), (offset), (direction), (styleRunPosition), (hPos), (we))
  547. #define CallWELineBreakProc(pText, textLength, textStart, textEnd, textWidth, textOffset, we, userRoutine) \
  548.     CallUniversalProc((userRoutine), uppWELineBreakProcInfo, (pText), (textLength), (textStart), (textEnd), (textWidth), (textOffset), (we))
  549. #define CallWEWordBreakProc(pText, textLength, offset, edge, breakOffsets, script, we, userRoutine) \
  550.     CallUniversalProc((userRoutine), uppWEWordBreakProcInfo, (pText), (textLength), (offset), (edge), (breakOffsets), (script), (we))
  551. #define CallWECharByteProc(pText, textOffset, script, we, userRoutine) \
  552.     CallUniversalProc((userRoutine), uppWECharByteProcInfo, (pText), (textOffset), (script), (we))
  553. #define CallWECharTypeProc(pText, textOffset, script, we, userRoutine) \
  554.     CallUniversalProc((userRoutine), uppWECharTypeProcInfo, (pText), (textOffset), (script), (we))
  555. #define CallWEEraseProc(area, we, userRoutine) \
  556.     CallUniversalProc((userRoutine), uppWEEraseProcInfo, (area), (we))
  557. #define CallWEFluxProc(offset, delta, we, userRoutine) \
  558.     CallUniversalProc((userRoutine), uppWEFluxProcInfo, (offset), (delta), (we))
  559. #define CallWENewObjectProc(defaultObjectSize, obj, userRoutine) \
  560.     CallUniversalProc((userRoutine), uppWENewObjectProcInfo, (defaultObjectSize), (obj))
  561. #define CallWEDisposeObjectProc(obj, userRoutine) \
  562.     CallUniversalProc((userRoutine), uppWEDisposeObjectProcInfo, (obj))
  563. #define CallWEDrawObjectProc(destRect, obj, userRoutine) \
  564.     CallUniversalProc((userRoutine), uppWEDrawObjectProcInfo, (destRect), (obj))
  565. #define CallWEClickObjectProc(hitPt, modifiers, clickTime, obj, userRoutine) \
  566.     CallUniversalProc((userRoutine), uppWEClickObjectProcInfo, (hitPt), (modifiers), (clickTime), (obj))
  567. #define CallWEStreamObjectProc(destKind, theType, putDataHere, obj, userRoutine) \
  568.     CallUniversalProc((userRoutine), uppWEStreamObjectProcInfo, (destKind), (theType), (putDataHere), (obj))
  569.  
  570. #else
  571.  
  572. typedef WEClickLoopProcPtr WEClickLoopUPP;
  573. typedef WEScrollProcPtr WEScrollUPP;
  574. typedef WETSMPreUpdateProcPtr WETSMPreUpdateUPP;
  575. typedef WETSMPostUpdateProcPtr WETSMPostUpdateUPP;
  576. typedef WETranslateDragProcPtr WETranslateDragUPP;
  577. typedef WEHiliteDropAreaProcPtr WEHiliteDropAreaUPP;
  578. typedef WEFontIDToNameProcPtr WEFontIDToNameUPP;
  579. typedef WEFontNameToIDProcPtr WEFontNameToIDUPP;
  580. typedef WEDrawTextProcPtr WEDrawTextUPP;
  581. typedef WEPixelToCharProcPtr WEPixelToCharUPP;
  582. typedef WECharToPixelProcPtr WECharToPixelUPP;
  583. typedef WELineBreakProcPtr WELineBreakUPP;
  584. typedef WEWordBreakProcPtr WEWordBreakUPP;
  585. typedef WECharByteProcPtr WECharByteUPP;
  586. typedef WECharTypeProcPtr WECharTypeUPP;
  587. typedef WEEraseProcPtr WEEraseUPP;
  588. typedef WEFluxProcPtr WEFluxUPP;
  589. typedef WENewObjectProcPtr WENewObjectUPP;
  590. typedef WEDisposeObjectProcPtr WEDisposeObjectUPP;
  591. typedef WEDrawObjectProcPtr WEDrawObjectUPP;
  592. typedef WEClickObjectProcPtr WEClickObjectUPP;
  593. typedef WEStreamObjectProcPtr WEStreamObjectUPP;
  594.  
  595. #define NewWEClickLoopProc(userRoutine) ((WEClickLoopUPP) (userRoutine))
  596. #define NewWEScrollProc(userRoutine) ((WEScrollUPP) (userRoutine))
  597. #define NewWETSMPreUpdateProc(userRoutine) ((WETSMPreUpdateUPP) (userRoutine))
  598. #define NewWETSMPostUpdateProc(userRoutine) ((WETSMPostUpdateUPP) (userRoutine))
  599. #define NewWETranslateDragProc(userRoutine) ((WETranslateDragUPP) (userRoutine))
  600. #define NewWEHiliteDropAreaProc(userRoutine) ((WEHiliteDropAreaUPP) (userRoutine))
  601. #define NewWEFontIDToNameProc(userRoutine) ((WEFontIDToNameUPP) (userRoutine))
  602. #define NewWEFontNameToIDProc(userRoutine) ((WEFontNameToIDUPP) (userRoutine))
  603. #define NewWEDrawTextProc(userRoutine) ((WEDrawTextUPP) (userRoutine))
  604. #define NewWEPixelToCharProc(userRoutine) ((WEPixelToCharUPP) (userRoutine))
  605. #define NewWECharToPixelProc(userRoutine) ((WECharToPixelUPP) (userRoutine))
  606. #define NewWELineBreakProc(userRoutine) ((WELineBreakUPP) (userRoutine))
  607. #define NewWEWordBreakProc(userRoutine) ((WEWordBreakUPP) (userRoutine))
  608. #define NewWECharByteProc(userRoutine) ((WECharByteUPP) (userRoutine))
  609. #define NewWECharTypeProc(userRoutine) ((WECharTypeUPP) (userRoutine))
  610. #define NewWEEraseProc(userRoutine) ((WEEraseUPP) (userRoutine))
  611. #define NewWEFluxProc(userRoutine) ((WEFluxUPP) (userRoutine))
  612. #define NewWENewObjectProc(userRoutine) ((WENewObjectUPP) (userRoutine))
  613. #define NewWEDisposeObjectProc(userRoutine) ((WEDisposeObjectUPP) (userRoutine))
  614. #define NewWEDrawObjectProc(userRoutine) ((WEDrawObjectUPP) (userRoutine))
  615. #define NewWEClickObjectProc(userRoutine) ((WEClickObjectUPP) (userRoutine))
  616. #define NewWEStreamObjectProc(userRoutine) ((WEStreamObjectUPP) (userRoutine))
  617.  
  618. #define CallWEClickLoopProc(we, userRoutine) \
  619.     (*(userRoutine))((we))
  620. #define CallWEScrollProc(we, userRoutine) \
  621.     (*(userRoutine))((we))
  622. #define CallWETSMPreUpdateProc(we, userRoutine) \
  623.     (*(userRoutine))((we))
  624. #define CallWETSMPostUpdateProc(we, fixLength, inputAreaStart, inputAreaEnd, pinRangeStart, pinRangeEnd, userRoutine) \
  625.     (*(userRoutine))((we), (fixLength), (inputAreaStart), (inputAreaEnd), (pinRangeStart), (pinRangeEnd))
  626. #define CallWETranslateDragProc(theDrag, theItem, requestedType, putDataHere, dropOffset, we, userRoutine) \
  627.     (*(userRoutine))((theDrag), (theItem), (requestedType), (putDataHere), (dropOffset), (we))
  628. #define CallWEHiliteDropAreaProc(theDrag, hiliteFlag, we, userRoutine) \
  629.     (*(userRoutine))((theDrag), (hiliteFlag), (we))
  630. #define CallWEFontIDToNameProc(fontID, fontName, userRoutine) \
  631.     (*(userRoutine))((fontID), (fontName))
  632. #define CallWEFontNameToIDProc(fontName, oldFontID, newFontID, userRoutine) \
  633.     (*(userRoutine))((fontName), (oldFontID), (newFontID))
  634. #define CallWEDrawTextProc(pText, textLength, slop, styleRunPosition, we, userRoutine) \
  635.     (*(userRoutine))((pText), (textLength), (slop), (styleRunPosition), (we))
  636. #define CallWEPixelToCharProc(pText, textLength, slop, pixelWidth, edge, styleRunPosition, hPos, we, userRoutine) \
  637.     (*(userRoutine))((pText), (textLength), (slop), (pixelWidth), (edge), (styleRunPosition), (hPos), (we))
  638. #define CallWECharToPixelProc(pText, textLength, slop, offset, direction, styleRunPosition, hPos, we, userRoutine) \
  639.     (*(userRoutine))((pText), (textLength), (slop), (offset), (direction), (styleRunPosition), (hPos), (we))
  640. #define CallWELineBreakProc(pText, textLength, textStart, textEnd, textWidth, textOffset, we, userRoutine) \
  641.     (*(userRoutine))((pText), (textLength), (textStart), (textEnd), (textWidth), (textOffset), (we))
  642. #define CallWEWordBreakProc(pText, textLength, offset, edge, breakOffsets, script, we, userRoutine) \
  643.     (*(userRoutine))((pText), (textLength), (offset), (edge), (breakOffsets), (script), (we))
  644. #define CallWECharByteProc(pText, textOffset, script, we, userRoutine) \
  645.     (*(userRoutine))((pText), (textOffset), (script), (we))
  646. #define CallWECharTypeProc(pText, textOffset, script, we, userRoutine) \
  647.     (*(userRoutine))((pText), (textOffset), (script), (we))
  648. #define CallWEEraseProc(area, we, userRoutine) \
  649.     (*(userRoutine))((area), (we))
  650. #define CallWEFluxProc(offset, delta, we, userRoutine) \
  651.     (*(userRoutine))((offset), (delta), (we))
  652. #define CallWENewObjectProc(defaultObjectSize, obj, userRoutine) \
  653.     (*(userRoutine))((defaultObjectSize), (obj))
  654. #define CallWEDisposeObjectProc(obj, userRoutine) \
  655.     (*(userRoutine))((obj))
  656. #define CallWEDrawObjectProc(destRect, obj, userRoutine) \
  657.     (*(userRoutine))((destRect), (obj))
  658. #define CallWEClickObjectProc(hitPt, modifiers, clickTime, obj, userRoutine) \
  659.     (*(userRoutine))((hitPt), (modifiers), (clickTime), (obj))
  660. #define CallWEStreamObjectProc(destKind, theType, putDataHere, obj, userRoutine) \
  661.     (*(userRoutine))((destKind), (theType), (putDataHere), (obj))
  662.  
  663. #endif
  664.  
  665.  
  666. /*    WASTE public calls */
  667.  
  668. /*    getting the shared library version number */
  669.  
  670. extern pascal UInt32 /* NumVersion */ WEVersion(void);
  671.  
  672. /*    creation and destruction */
  673.  
  674. extern pascal OSErr WENew(const LongRect *destRect, const LongRect *viewRect, UInt32 flags, WEReference *we);
  675. extern pascal void WEDispose(WEReference we);
  676.  
  677. /*    getting variables */
  678.  
  679. extern pascal Handle WEGetText(WEReference we);
  680. extern pascal SInt16 WEGetChar(SInt32 offset, WEReference we);
  681. extern pascal SInt32 WEGetTextLength(WEReference we);
  682. extern pascal SInt32 WEGetHeight(SInt32 startLine, SInt32 endLine, WEReference we);
  683. extern pascal void WEGetSelection(SInt32 *selStart, SInt32 *selEnd, WEReference we);
  684. extern pascal void WEGetDestRect(LongRect *destRect, WEReference we);
  685. extern pascal void WEGetViewRect(LongRect *viewRect, WEReference we);
  686. extern pascal Boolean WEIsActive(WEReference we);
  687. extern pascal SInt32 WEOffsetToLine(SInt32 offset, WEReference we);
  688. extern pascal void WEGetLineRange(SInt32 lineIndex, SInt32 *lineStart, SInt32 *lineEnd, WEReference we);
  689. extern pascal SInt32 WECountLines(WEReference we);
  690. extern pascal SInt32 WEOffsetToRun(SInt32 offset, WEReference we);
  691. extern pascal void WEGetRunRange(SInt32 runIndex, SInt32 *runStart, SInt32 *runEnd, WEReference we);
  692. extern pascal SInt32 WECountRuns(WEReference we);
  693. extern pascal UInt16 WEGetClickCount(WEReference we);
  694.  
  695. /*    setting variables */
  696.  
  697. extern pascal void WESetSelection(SInt32 selStart, SInt32 selEnd, WEReference we);
  698. extern pascal void WESetDestRect(const LongRect *destRect, WEReference we);
  699. extern pascal void WESetViewRect(const LongRect *viewRect, WEReference we);
  700.  
  701. /*    accessing style run information */
  702.  
  703. extern pascal Boolean WEContinuousStyle(WEStyleMode *mode, TextStyle *ts, WEReference we);
  704. extern pascal void WEGetRunInfo(SInt32 offset, WERunInfo *runInfo, WEReference we);
  705. extern pascal Boolean WEGetRunDirection(SInt32 offset, WEReference we);
  706.  
  707. /*    converting byte offsets to screen position and vice versa */
  708.  
  709. extern pascal SInt32 WEGetOffset(const LongPt *thePoint, WEEdge *edge, WEReference we);
  710. extern pascal void WEGetPoint(SInt32 offset, SInt16 direction, LongPt *thePoint, SInt16 *lineHeight, WEReference we);
  711.  
  712. /*    finding words, lines and paragraphs */
  713.  
  714. extern pascal void WEFindWord(SInt32 offset, WEEdge edge, SInt32 *wordStart, SInt32 *wordEnd, WEReference we);
  715. extern pascal void WEFindLine(SInt32 offset, WEEdge edge, SInt32 *lineStart, SInt32 *lineEnd, WEReference we);
  716. extern pascal void WEFindParagraph(SInt32 offset, WEEdge edge, SInt32 *paragraphStart, SInt32 *paragraphEnd, WEReference we);
  717.  
  718. /*    making a copy of a text range */
  719.  
  720. extern pascal OSErr WECopyRange(SInt32 rangeStart, SInt32 rangeEnd, Handle hText, StScrpHandle hStyles, WESoupHandle hSoup, WEReference we);
  721.  
  722. /*    getting and setting the alignment style */
  723.  
  724. extern pascal WEAlignment WEGetAlignment(WEReference we);
  725. extern pascal void WESetAlignment(WEAlignment alignment, WEReference we);
  726.  
  727. /*    getting and setting the primary line direction */
  728.  
  729. extern pascal WEDirection WEGetDirection(WEReference we);
  730. extern pascal void WESetDirection(WEDirection direction, WEReference we);
  731.  
  732. /*    recalculating line breaks, drawing and scrolling */
  733.  
  734. extern pascal OSErr WECalText(WEReference we);
  735. extern pascal void WEUpdate(RgnHandle updateRgn, WEReference we);
  736. extern pascal void WEScroll(SInt32 hOffset, SInt32 vOffset, WEReference we);
  737. extern pascal void WESelView(WEReference we);
  738.  
  739. /*    handling activate / deactivate events */
  740.  
  741. extern pascal void WEActivate(WEReference we);
  742. extern pascal void WEDeactivate(WEReference we);
  743.  
  744. /*     handling key-down events */
  745.  
  746. extern pascal void WEKey(SInt16 key, EventModifiers modifiers, WEReference we);
  747.  
  748. /*    handling mouse-down events and mouse tracking */
  749.  
  750. extern pascal void WEClick(Point hitPt, EventModifiers modifiers, UInt32 clickTime, WEReference we);
  751.  
  752. /*    adjusting the cursor shape */
  753.  
  754. extern pascal Boolean WEAdjustCursor(Point mouseLoc, RgnHandle mouseRgn, WEReference we);
  755.  
  756. /*    blinking the caret */
  757.  
  758. extern pascal void WEIdle(UInt32 *maxSleep, WEReference we);
  759.  
  760. /*    modifying the text and the styles */
  761.  
  762. extern pascal OSErr WEInsert(const void *pText, SInt32 textLength, StScrpHandle hStyles, WESoupHandle hSoup, WEReference we);
  763. extern pascal OSErr WEDelete(WEReference we);
  764. extern pascal OSErr WESetStyle(WEStyleMode mode, const TextStyle *ts, WEReference we);
  765. extern pascal OSErr WEUseStyleScrap(StScrpHandle hStyles, WEReference we);
  766. extern pascal OSErr WEUseText(Handle hText, WEReference we);
  767.  
  768. /*    undo */
  769.  
  770. extern pascal OSErr WEUndo(WEReference we);
  771. extern pascal void WEClearUndo(WEReference we);
  772. extern pascal WEActionKind WEGetUndoInfo(Boolean *redoFlag, WEReference we);
  773. extern pascal Boolean WEIsTyping(WEReference we);
  774. extern pascal OSErr WEBeginAction(WEReference we);
  775. extern pascal OSErr WEEndAction(WEActionKind actionKind, WEReference we);
  776.  
  777. /*    keeping track of changes */
  778.  
  779. extern pascal UInt32 WEGetModCount(WEReference we);
  780. extern pascal void WEResetModCount(WEReference we);
  781.  
  782. /*    embedded objects */
  783.  
  784. extern pascal OSErr WEInstallObjectHandler(FlavorType objectType, WESelector handlerSelector, UniversalProcPtr handler, WEReference we);
  785. extern pascal OSErr WEGetObjectHandler(FlavorType objectType, WESelector handlerSelector, UniversalProcPtr *handler, WEReference we);
  786. extern pascal OSErr WEInsertObject(FlavorType objectType, Handle objectDataHandle, Point objectSize, WEReference we);
  787. extern pascal OSErr WEGetSelectedObject(WEObjectReference *obj, WEReference we);
  788. extern pascal SInt32 WEFindNextObject(SInt32 offset, WEObjectReference *obj, WEReference we);
  789. extern pascal OSErr WEUseSoup(WESoupHandle hSoup, WEReference we);
  790.  
  791. /*    accessing embedded object attributes */
  792.  
  793. extern pascal FlavorType WEGetObjectType(WEObjectReference obj);
  794. extern pascal Handle WEGetObjectDataHandle(WEObjectReference obj);
  795. extern pascal Point WEGetObjectSize(WEObjectReference obj);
  796. extern pascal WEReference WEGetObjectOwner(WEObjectReference obj);
  797. extern pascal SInt32 WEGetObjectRefCon(WEObjectReference obj);
  798. extern pascal void WESetObjectRefCon(WEObjectReference obj, SInt32 refCon);
  799.  
  800. /*    clipboard operations */
  801.  
  802. extern pascal OSErr WECut(WEReference we);
  803. extern pascal OSErr WECopy(WEReference we);
  804. extern pascal OSErr WEPaste(WEReference we);
  805. extern pascal Boolean WECanPaste(WEReference we);
  806.  
  807. /*    Drag Manager support */
  808.  
  809. extern pascal RgnHandle WEGetHiliteRgn(SInt32 rangeStart, SInt32 rangeEnd, WEReference we);
  810. extern pascal OSErr WETrackDrag(DragTrackingMessage message, DragReference drag, WEReference we);
  811. extern pascal OSErr WEReceiveDrag(DragReference drag, WEReference we);
  812. extern pascal Boolean WECanAcceptDrag(DragReference drag, WEReference we);
  813. extern pascal Boolean WEDraggedToTrash(DragReference drag);
  814.  
  815. /*    font tables */
  816.  
  817. extern pascal OSErr WEBuildFontTable(WEFontTableHandle hFontTable, WEFontIDToNameUPP fontIDToNameProc, WEReference we);
  818. extern pascal OSErr WEUpdateFontTable(WEFontTableHandle hFontTable, WEFontNameToIDUPP fontNameToIDProc, Boolean *wasChanged);
  819. extern pascal OSErr WEUpdateStyleScrap(StScrpHandle hStyles, WEFontTableHandle hFontTable);
  820.  
  821. /*    Script Manager utilities */
  822.  
  823. extern pascal SInt16 WECharByte(SInt32 offset, WEReference we);
  824. extern pascal SInt16 WECharType(SInt32 offset, WEReference we);
  825.  
  826. /*    Text Services Manager support */
  827.  
  828. extern pascal OSErr WEInstallTSMHandlers(void);
  829. extern pascal OSErr WERemoveTSMHandlers(void);
  830. extern pascal OSErr WEHandleTSMEvent(const AppleEvent *ae, AppleEvent *reply);
  831. extern pascal void WEStopInlineSession(WEReference we);
  832.  
  833. /*    additional features */
  834.  
  835. extern pascal SInt16 WEFeatureFlag(SInt16 feature, SInt16 action, WEReference we);
  836. extern pascal OSErr WEGetInfo(WESelector selector, void *info, WEReference we);
  837. extern pascal OSErr WESetInfo(WESelector selector, const void *info, WEReference we);
  838.  
  839. /*    getting and setting user-defined info */
  840.  
  841. extern pascal OSErr WEGetUserInfo(WESelector tag, SInt32 *userInfo, WEReference we);
  842. extern pascal OSErr WESetUserInfo(WESelector tag, SInt32 userInfo, WEReference we);
  843.  
  844. /*    long coordinate utilities */
  845.  
  846. extern pascal void WELongPointToPoint(const LongPt *lp, Point *p);
  847. extern pascal void WEPointToLongPoint(Point p, LongPt *lp);
  848. extern pascal void WESetLongRect(LongRect *lr, SInt32 left, SInt32 top, SInt32 right, SInt32 bottom);
  849. extern pascal void WELongRectToRect(const LongRect *lr, Rect *r);
  850. extern pascal void WERectToLongRect(const Rect *r, LongRect *lr);
  851. extern pascal void WEOffsetLongRect(LongRect *lr, SInt32 hOffset, SInt32 vOffset);
  852. extern pascal Boolean WELongPointInLongRect(const LongPt *lp, const LongRect *lr);
  853.  
  854. #if PRAGMA_IMPORT_SUPPORTED
  855. #pragma import off
  856. #endif
  857.  
  858. #if PRAGMA_ALIGN_SUPPORTED
  859. #pragma options align=reset
  860. #endif
  861.  
  862. #ifdef __cplusplus
  863. }
  864. #endif
  865.  
  866. #endif    /* _WASTE_ */
  867.